<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>2-20 拐角</title>
</head>
<body>
  <canvas id="c" width="300" height="300" style="border: 1px solid #ccc;"></canvas>

  <script>
    const context = document.getElementById('c')
    const ctx = context.getContext('2d')
    
    ctx.lineWidth = 20

    // 默认，尖角
    ctx.moveTo(50, 40)
    ctx.lineTo(200, 40)
    ctx.lineTo(200, 90)
    ctx.stroke()

    // 斜角 bevel
    ctx.beginPath()
    ctx.moveTo(50, 140)
    ctx.lineTo(200, 140)
    ctx.lineTo(200, 190)
    ctx.lineJoin = 'bevel'
    ctx.stroke()

    // 圆角 round
    ctx.beginPath()
    ctx.moveTo(50, 240)
    ctx.lineTo(200, 240)
    ctx.lineTo(200, 290)
    ctx.lineJoin = 'round'
    ctx.stroke()
  </script>
</body>
</html>